package com.test.DBDemo;

import com.mysql.jdbc.Driver;
import org.junit.Test;

import java.sql.*;

/**
 * ${DESCRIPTION}
 *
 * @author muxiaoyu
 * @create 2017/06/06 16:50
 **/
public class DbDemo {
    public static void main(String[] args) throws SQLException {
        DriverManager.registerDriver(new Driver());
        Connection connection = DriverManager.getConnection("jdbc:mysql://localhost:3306/demo", "root", "123");
        Statement statement = connection.createStatement();
        ResultSet resultSet = statement.executeQuery("SELECT * FROM T_USER");
        while (resultSet.next()) {
            System.out.println(resultSet.getInt(1));
            System.out.println(resultSet.getString(2));
            System.out.println(resultSet.getString(3));
            System.out.println(resultSet.getString(4));
            System.out.println(resultSet.getInt(5));
            System.out.println(resultSet.getDate(6));
            System.out.println("=================================");
        }
    }

    @Test
    public void test666() {

    }
}
